fix: Allow Item.Member after HasSingleItem - #6583
Conversation
📝 WalkthroughWalkthrough
ChangesMember assertion fix
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR routes type-erased member assertions through the standard assertion pipeline so deferred pre-work is preserved for
Confidence Score: 5/5The PR appears safe to merge, with no actionable correctness or security issues identified. The changed wrapper preserves deferred pre-work through mapped assertion contexts, executes it once, and continues to propagate inner assertion failures through the existing exception and assertion-scope mechanisms.
|
| Filename | Overview |
|---|---|
| src/TUnit.Assertions/Conditions/MemberAssertion.cs | Moves type-erased member assertion execution into the base assertion pipeline, preserving mapped pending pre-work without introducing duplicate execution or failure masking. |
| tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs | Adds focused regression coverage for member assertions following both forms of HasSingleItem().Item. |
Reviews (1): Last reviewed commit: "fix: Allow Item.Member after HasSingleIt..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs (1)
13-15: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd failing member-assertion cases.
These tests prove that the chain does not throw for matching values. They do not prove that
Member(...).IsEqualTo(...)executes. If the inner assertion were skipped, both tests would still pass. Add negative-path cases with a mismatched member value and the existing assertion-failure helper.Also applies to: 27-29
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs` around lines 13 - 15, Add negative-path tests in the affected member-assertion test cases, using a mismatched member value and the existing assertion-failure helper. Ensure each case verifies that Member(...).IsEqualTo(...) executes and reports failure, while preserving the current matching-value coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs`:
- Around line 13-15: Add negative-path tests in the affected member-assertion
test cases, using a mismatched member value and the existing assertion-failure
helper. Ensure each case verifies that Member(...).IsEqualTo(...) executes and
reports failure, while preserving the current matching-value coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6e93d3a9-f5da-404c-8f8e-52710a8c4987
📒 Files selected for processing (2)
src/TUnit.Assertions/Conditions/MemberAssertion.cstests/TUnit.Assertions.Tests/Bugs/Issue6581Tests.cs
|
Thanks @SnakyBeaky ! |
Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.64.6 to 1.65.0. <details> <summary>Release notes</summary> _Sourced from [TUnit's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.65.0 <!-- Release notes generated using configuration in .github/release.yml at v1.65.0 --> ## What's Changed ### Other Changes * Report unexpected mock generation failures by @thomhurst in thomhurst/TUnit#6605 * Process every GenerateMock attribute by @thomhurst in thomhurst/TUnit#6606 * Support T.Mock() for static abstract interfaces by @thomhurst in thomhurst/TUnit#6607 ### Dependencies * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.303 by @thomhurst in thomhurst/TUnit#6586 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.303 by @thomhurst in thomhurst/TUnit#6587 * chore(deps): update microsoft.build to 18.9.6 by @thomhurst in thomhurst/TUnit#6585 * chore(deps): update dependency fsharp.core to 10.1.400 by @thomhurst in thomhurst/TUnit#6588 * chore(deps): update dependency microsoft.entityframeworkcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6589 * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.400 by @thomhurst in thomhurst/TUnit#6591 * chore(deps): update dependency dotnet-sdk to v10.0.400 by @thomhurst in thomhurst/TUnit#6590 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.400 by @thomhurst in thomhurst/TUnit#6592 * chore(deps): update dependency system.commandline to 2.0.11 by @thomhurst in thomhurst/TUnit#6593 * chore(deps): update microsoft.extensions to 10.0.11 by @thomhurst in thomhurst/TUnit#6595 * chore(deps): update microsoft.aspnetcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6594 * chore(deps): update tunit to 1.64.13 by @thomhurst in thomhurst/TUnit#6596 * chore(deps): update dependency nuget.protocol to 7.9.0 by @thomhurst in thomhurst/TUnit#6597 * chore(deps): update microsoft.extensions to 10.9.0 by @thomhurst in thomhurst/TUnit#6598 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6601 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6600 * chore(deps): update dependency microsoft.testing.extensions.codecoverage to 18.10.0 by @thomhurst in thomhurst/TUnit#6602 **Full Changelog**: thomhurst/TUnit@v1.64.13...v1.65.0 ## 1.64.13 <!-- Release notes generated using configuration in .github/release.yml at v1.64.13 --> ## What's Changed ### Other Changes * Stabilize immediate WaitsFor assertion test by @thomhurst in thomhurst/TUnit#6576 * fix: Allow Item.Member after HasSingleItem by @SnakyBeaky in thomhurst/TUnit#6583 ### Dependencies * chore(deps): update tunit to 1.64.6 by @thomhurst in thomhurst/TUnit#6577 * chore(deps): update dependency nsubstitute to 6.2.0 by @thomhurst in thomhurst/TUnit#6580 * chore(deps): update dependency microsoft.playwright to 1.62.0 by @thomhurst in thomhurst/TUnit#6582 * chore(deps): update dependency microsoft.net.stringtools to 18.9.6 by @thomhurst in thomhurst/TUnit#6584 ## New Contributors * @SnakyBeaky made their first contribution in thomhurst/TUnit#6583 **Full Changelog**: thomhurst/TUnit@v1.64.6...v1.64.13 Commits viewable in [compare view](thomhurst/TUnit@v1.64.6...v1.65.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updated [TUnit.Core](https://github.com/thomhurst/TUnit) from 1.64.6 to 1.65.0. <details> <summary>Release notes</summary> _Sourced from [TUnit.Core's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.65.0 <!-- Release notes generated using configuration in .github/release.yml at v1.65.0 --> ## What's Changed ### Other Changes * Report unexpected mock generation failures by @thomhurst in thomhurst/TUnit#6605 * Process every GenerateMock attribute by @thomhurst in thomhurst/TUnit#6606 * Support T.Mock() for static abstract interfaces by @thomhurst in thomhurst/TUnit#6607 ### Dependencies * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.303 by @thomhurst in thomhurst/TUnit#6586 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.303 by @thomhurst in thomhurst/TUnit#6587 * chore(deps): update microsoft.build to 18.9.6 by @thomhurst in thomhurst/TUnit#6585 * chore(deps): update dependency fsharp.core to 10.1.400 by @thomhurst in thomhurst/TUnit#6588 * chore(deps): update dependency microsoft.entityframeworkcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6589 * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.400 by @thomhurst in thomhurst/TUnit#6591 * chore(deps): update dependency dotnet-sdk to v10.0.400 by @thomhurst in thomhurst/TUnit#6590 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.400 by @thomhurst in thomhurst/TUnit#6592 * chore(deps): update dependency system.commandline to 2.0.11 by @thomhurst in thomhurst/TUnit#6593 * chore(deps): update microsoft.extensions to 10.0.11 by @thomhurst in thomhurst/TUnit#6595 * chore(deps): update microsoft.aspnetcore to 10.0.11 by @thomhurst in thomhurst/TUnit#6594 * chore(deps): update tunit to 1.64.13 by @thomhurst in thomhurst/TUnit#6596 * chore(deps): update dependency nuget.protocol to 7.9.0 by @thomhurst in thomhurst/TUnit#6597 * chore(deps): update microsoft.extensions to 10.9.0 by @thomhurst in thomhurst/TUnit#6598 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6601 * chore(deps): update dependency polyfill to 11.2.0 by @thomhurst in thomhurst/TUnit#6600 * chore(deps): update dependency microsoft.testing.extensions.codecoverage to 18.10.0 by @thomhurst in thomhurst/TUnit#6602 **Full Changelog**: thomhurst/TUnit@v1.64.13...v1.65.0 ## 1.64.13 <!-- Release notes generated using configuration in .github/release.yml at v1.64.13 --> ## What's Changed ### Other Changes * Stabilize immediate WaitsFor assertion test by @thomhurst in thomhurst/TUnit#6576 * fix: Allow Item.Member after HasSingleItem by @SnakyBeaky in thomhurst/TUnit#6583 ### Dependencies * chore(deps): update tunit to 1.64.6 by @thomhurst in thomhurst/TUnit#6577 * chore(deps): update dependency nsubstitute to 6.2.0 by @thomhurst in thomhurst/TUnit#6580 * chore(deps): update dependency microsoft.playwright to 1.62.0 by @thomhurst in thomhurst/TUnit#6582 * chore(deps): update dependency microsoft.net.stringtools to 18.9.6 by @thomhurst in thomhurst/TUnit#6584 ## New Contributors * @SnakyBeaky made their first contribution in thomhurst/TUnit#6583 **Full Changelog**: thomhurst/TUnit@v1.64.6...v1.64.13 Commits viewable in [compare view](thomhurst/TUnit@v1.64.6...v1.65.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Description
Ensure TypeErasedAssertion uses the standard assertion execution pipeline, preserving deferred pre-work from
HasSingleItem().Item.Added a regression coverage test for the issue.
Related Issue
Fixes #6581
Type of Change
Checklist
Required
Testing
dotnet test)Summary by CodeRabbit
Bug Fixes
Tests